package com.hd.contentmonitor.service;

/*
Core SWING Advanced Programming 
By Kim Topley
ISBN: 0 13 083292 8       
Publisher: Prentice Hall  
*/

import java.awt.Container;
import java.awt.GridLayout;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;

import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;

public class TextPaneTest {
	public static void main(String args[]) {
		String title = (args.length == 0 ? "TextArea Example" : args[0]);
		JFrame frame = new JFrame(title);
		Container content = frame.getContentPane();
		content.setLayout(new GridLayout(0, 2));
		JTextArea leftTextArea = new JTextArea();
		
		JScrollPane rightPane = new JScrollPane(leftTextArea);
		// JScrollPane leftPane = new JScrollPane(rightTextArea);
		try {
		
		    leftTextArea.read(new FileReader("D:\\temp1.html"),
		            null);
		
		} catch (FileNotFoundException e) {
		    // TODO Auto-generated catch block
		    e.printStackTrace();
		} catch (IOException e) {
		    // TODO Auto-generated catch block
		    e.printStackTrace();
		}
		
		content.add(leftTextArea);
		
		
		JTextArea rightTextArea = new JTextArea() {
		    public boolean isManagingFocus() {
		        return false;
		    }
		};
		
		JScrollPane leftPane1 = new JScrollPane(rightTextArea);
		JScrollPane rightPane1 = new JScrollPane(leftTextArea);
		
		try {
		    rightTextArea.read(new FileReader("D:\\tempold1.html"),
		            null);
		} catch (FileNotFoundException e) {
		    // TODO Auto-generated catch block
		    e.printStackTrace();
		} catch (IOException e) {
		    // TODO Auto-generated catch block
		    e.printStackTrace();
		}
		content.add(leftPane1);
		content.add(rightPane1);
		frame.setSize(250, 150);
		frame.setVisible(true);
	}
} 

